/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package dbFish;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author mesias
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        try {                   
            
            HashMap hm2 = new HashMap();
            HashMap hm3 = new HashMap();
            
            //hm2.put("Numero_do_Pescador", 1);
            hm2.put("CPF", 123123123);
            hm2.put("RG", 12341333);
            hm2.put("RP", 1);
            hm2.put("nome", "Zé Mané");
            hm2.put("sobrenome", "da Silva");
            hm2.put("apelido", "ze");
            SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
            Date  data = null;
            try {
                data = sdf.parse("10/10/2009");
            } catch (ParseException ex) {
                Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
            }
            hm2.put("data_de_nascimento", data);
            hm2.put("logradouro", "rua dos bobos");
            hm2.put("numero", "330");
            hm2.put("bairro", "João Aranha");
            hm2.put("cidade", "Paulínia");
            hm2.put("estado", "SP");
            hm2.put("cep", 13140000);
            hm2.put("telefone", 13140000);
            hm2.put("celular", 13140000);
            hm2.put("email", "bla@blabla.com");
            hm2.put("peixe_preferido", "tilapia");
            hm2.put("sexo", "m");
            hm2.put("carteirinha", "s");
            
            hm3.put("RP", 1);
            hm3.put("nome", "Pesqueiro do Mar");
            hm3.put("Logradouro", "Sítio são josé");
            hm3.put("numero", 0);
            hm3.put("bairro", "João Aranha");
            hm3.put("cidade", "Paulínia");
            hm3.put("estado", "SP");
            hm3.put("cep", 13140);
            hm3.put("telefone", 38445337);
            hm3.put("email", "");
            
               
          // HashMap hmr = HashPersistence.getInstance().doInsert(hm3, "pesqueiros");
           HashMap hmr2 = HashPersistence.getInstance().doInsert(hm2, "clientes");
           
//            Object bla = HashPersistence.getInstance().doRawSQL("select * from servicos");
//            System.out.println(bla.toString() + bla.getClass());
//            
//            ArrayList al = (ArrayList) bla;
//            HashMap hm = (HashMap) al.get(0);
              
            for (Object ob : hmr2.keySet()) {
                System.out.println("Chave: " + ob + " Classe: " + ob.getClass() + "Valor: " + hmr2.get(ob) + " Classe: " + hmr2.get(ob).getClass());
            }
            
//            System.out.println(hm.get("Num_Serv"));
            
            HashPersistence.shutdown();

        } catch (HashPersistenceException ex) {
            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

}

